 public class Solution {
     /**
      * Definition for a binary tree node.
      * public class TreeNode {
      *     int val;
      *     TreeNode left;
      *     TreeNode right;
      *     TreeNode() {}
      *     TreeNode(int val) { this.val = val; }
      *     TreeNode(int val, TreeNode left, TreeNode right) {
      *         this.val = val;
      *         this.left = left;
      *         this.right = right;
      *     }
      * }
      */
     class Solution {
         public boolean isSameTree(TreeNode p, TreeNode q) {
             if(p == null || q == null) return p == q;

             return p.val == q.val && isSameTree(p.left, q.left) && isSameTree(p.right, q.right);
         }
         public boolean checkSubTree(TreeNode root, TreeNode subroot) {
             if(root == null) return false;

             return isSameTree(root, subroot) ||
                     checkSubTree(root.left, subroot) ||
                     checkSubTree(root.right, subroot);
         }
     }
}